﻿/*----------------------------------------------------------------
//  <copyright file="RoleOrganizationBase.cs" company="MicroCloud@151504200868">
//      Copyright © 2020-2024 MicroCloud Corporation, All rights reserved.
//  </copyright>
//  <site>https://gitee.com/chenmm123/microclouds</site>
//  <last-editor>cmm</last-editor>
//  <last-date>2023-12-06 18:30</last-date>
//----------------------------------------------------------------*/

namespace MicroCloud.Identity.Entities
{
    #region "角色组织机构映射基类"
    /// <summary>
    /// 角色组织机构映射基类
    /// </summary>
    /// <typeparam name="TKey">角色组织机构映射编号类型</typeparam>
    /// <typeparam name="TRoleKey">角色编号类型</typeparam>
    /// <typeparam name="TOrganizationKey">组织机构编号类型</typeparam>
    public abstract class RoleOrganizationBase<TKey, TRoleKey, TOrganizationKey> : EntityBase<TKey>, ILockable, ICreatedTime
        where TKey : struct, IEquatable<TKey>
        where TRoleKey : struct, IEquatable<TRoleKey>
        where TOrganizationKey : struct, IEquatable<TOrganizationKey>
    {
        #region "属性"
        #region "获取或设置 角色编号"
        /// <summary>
        /// 获取或设置 角色编号
        /// </summary>
        [Column("RoleId")]
        [Required]
        [DisplayName("角色编号")]
        public TRoleKey RoleId { get; set; }
        #endregion
        #region "获取或设置 组织机构编号"
        /// <summary>
        /// 获取或设置 组织机构编号
        /// </summary>
        [Column("OrganizationId")]
        [Required]
        [DisplayName("组织机构编号")]
        public TOrganizationKey OrganizationId { get; set; }
        #endregion
        #region "获取或设置 机构管理员"
        /// <summary>
        /// 获取或设置 机构管理员
        /// </summary>
        [Column("Administrator")]
        [DisplayName("机构管理员")]
        public bool Administrator { get; set; }
        #endregion
        #region "获取或设置 机构经理"
        /// <summary>
        /// 获取或设置 机构经理
        /// </summary>
        [Column("Leader")]
        [DisplayName("机构经理")]
        public bool Leader { get; set; }
        #endregion

        #region "获取或设置 是否锁定当前信息，ILockable 可装载接口，用于IEnumerable、IQueryable筛选"
        /// <summary>
        /// 获取或设置 是否锁定当前信息
        /// </summary>
        [Column("IsLocked")]
        [DisplayName("是否锁定")]
        public bool IsLocked { get; set; }
        #endregion

        #region "获取或设置 创建时间 ICreatedTime、ICreationAudited  可装载接口，在数据创建时可自动设置当前时间"
        /// <summary>
        /// 获取或设置 创建时间
        /// </summary>
        [Column("CreatedTime")]
        [DisplayName("创建时间")]
        public DateTime CreatedTime { get; set; }
        #endregion

        #endregion

        #region "构造函数"
        #region "初始化一个角色组织机构映射基类的新实例"
        /// <summary>
        /// 初始化一个角色组织机构映射基类的新实例 <see cref="UserOrganizationBase{TKey, TRoleKey, TOrganizationKey}"/> 的新实例
        /// </summary>
        protected RoleOrganizationBase()
        {
            CreatedTime = DateTime.Now;
        }
        #endregion

        #endregion

    }
    #endregion

}
